{% load ratio %}
{% load get_attr %}
{% load show_diff_title %}
{% load problem_index %}
<form id="batch-manage-form" action="" method="post">
    <table class="table table-bordered table-striped table-hover">
        <thead>
            <tr>
                <th>题号</th>
                <th>题目名称</th>
                <th>要求</th>
                <th>分值</th>
                <th>发布者</th>
                <th>难度</th>
                <th>总体通过率</th>
                <th>{% if user_session.user_role >= 2 %}管理{% else %}得分 (AC / PE / ALL){% endif %}</th>
            </tr>
        </thead>
        <tbody>
        {% for aproblem in problem_list %}
        <tr class="problem_items" data-id="{{ aproblem.id }}" data-index="{{ forloop.counter }}">
            <td>

                {{ aproblem.index | problem_index }}
                {% if not asgn.hideProblemId or user_session.user_role >= 2 %}
                     ({{ aproblem.problem.id }})
                {% endif %}
            </td>
            <td>
                <a href="{% url 'asgn_show_asgn_problem' asgn.id aproblem.id %}">
                    {% if asgn != None and asgn.hideProblemTitle %}
                        题目{{ aproblem.index | problem_index }}
                    {% else %}
                        {{ aproblem.problem.title }}
                    {% endif %}
                </a>
                {% if aproblem.problem.pause_judge %}<span class="glyphicon glyphicon-pause" title="评测暂停"></span>{% endif %}
            </td>
            <td>{%  if aproblem.require %}必做题{% else %}选做题{% endif %}{% if aproblem.ignore_pe %}，PE可得分{% endif %}</td>
            <td>{{ aproblem.score }}分</td>
            <td><a href="{% url "account_space" aproblem.problem.author.id %}" target="_blank">{{ aproblem.problem.author.nickname }}</a></td>
            <td>{{ aproblem.problem.difficulty | show_diff_title }}</td>
            <td>
                {{ aproblem.judge_ratio }}
            </td>
            <td>
                {% if user_session.user_role >= 2 %}
                <div class="btn-group dropdown">
                    <a href="javascript:void(0)" class="label label-warning dropdown-toggle" data-toggle="dropdown">
                        <span class="glyphicon glyphicon-wrench"></span>&nbsp;管理题目&nbsp;<span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
                        {% if asgn != None %}
                            <li><a href="javascript:void(0)" class="asgn_problem_setting" data-id="{{ aproblem.id }}">题目设置</a></li>
                            <li class="divider"></li>
                        {% endif %}
                        <li><a href="{% url 'problem_mgr_modify_problem' aproblem.problem.id %}#info" target="_blank">编辑题目</a></li>
                        <li><a href="{% url 'problem_mgr_modify_problem' aproblem.problem.id %}#demo-code" target="_blank">示例代码</a></li>
                        <li><a href="{% url 'problem_mgr_modify_problem' aproblem.problem.id %}#test-data" target="_blank">测试数据</a></li>
                        <li><a href="{% url 'problem_mgr_modify_problem' aproblem.problem.id %}#classify" target="_blank">题目分类</a></li>
                        <li class="divider"></li>
                        {% if asgn == None %}
                        <li><a href="{% url 'problem_mgr_modify_problem' problem.id %}#delete" target="_blank">删除题目</a></li>
                        {% else %}
                        <li><a href="javascript:void(0)" class="remove_asgn_problem" data-id="{{ aproblem.id }}">移除题目</a></li>
                        {% endif %}
                    </ul>
                </div>
                <a href="javascript:void(0)" class="label label-success btn-setorder-up"><span class="glyphicon glyphicon-arrow-up"></span></a>
                {% else %}
                    {{ student_finished | get_attr:aproblem.id | safe }}
                {% endif %}
            </td>
        </tr>
{#        <tr class="problem_detail_panel">#}
{#            <td colspan="8">#}
{#            <span id="problem_detail_area_{{ aproblem.problem.id }}"></span><br />#}
{#            </td>#}
{#        </tr>#}
        {% empty %}
            <tr>
                <td colspan="8">哎呀，还没有题目呢！</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% if user_session.user_role >= 2 %}
    <div class="btn-group">
        <button type="button" class="btn btn-success" id="btn-save-order">保存排序</button>
    </div>
    {% endif %}
</form>

